
"""
Created on Tue Feb 19 14:55:43 2013

@author: aponteeduarddo@gmail.com
Copyright Eduardo Aponte 2013.
"""

from mex_binder import binder_py

eyelink_reset_data = binder_py('mx_eyelink_reset_data')
eyelink_reset_data.mx_c.headers = ['<eyelink.h>','"mex.h"','"utils.h"']
eyelink_reset_data.bindo += ['utils.o']
eyelink_reset_data.mx_c.code = \
"""
INT16 _main( INT16 cl )
{
    return eyelink_reset_data( cl ) ;
}

void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
    int bt;
    mwSize td[] = {1,1};
    double *status;
    
    
    /* Verify input arguments. */
    if(nrhs != 1 ) {
        mexErrMsgTxt("Incorrect number of inputs.");
    } else if( nlhs > 1 ) {
        mexErrMsgTxt("Too many output arguments.");
    }
    
    if ( isscalar( prhs[0] ) ){
        if ( returnscalar( prhs[0], &bt ) != 1 )
            mexErrMsgTxt("Complex data is not supported.");                
    } else {
        mexErrMsgTxt("clear should be a scalar."); 
    } 
      
    plhs[0] = mxCreateNumericArray( 2, td, mxDOUBLE_CLASS, mxREAL);
    status = mxGetPr(plhs[0]);    
    *status = (double ) _main( (INT16 ) bt );
    
    return;
}
"""

eyelink_reset_data.mx_c.mdoc = \
"""function [ status ] = mx_eyelink_reset_data( clear )
%MX_EYELINK_RESET_DATA Prepares link buffers to receive new data. If <clear>
% is nonzero, removes old data from buffer.

% Parameters:
% clear 	If clear is non-zero, any buffer data is discarded.
% Returns:
% Always returns 0.
%
"""
eyelink_reset_data.write_c()
eyelink_reset_data.write_m()
eyelink_reset_data.compile()
eyelink_reset_data.write_sh()

